<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@taglib uri="/struts-tags" prefix="s" %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML>
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>后台管理</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->
	    <meta charset="UTF-8">
    <title>后台管理</title>
    <link rel="stylesheet" type="text/css" href="UI/admins/css/common.css"/>
    <link rel="stylesheet" type="text/css" href="UI/admins/css/main.css"/>
    <link rel="stylesheet" type="text/css" href="UI/css/jquery.datetimepicker.css"/>
    <script type="text/javascript" src="UI/admins/js/libs/modernizr.min.js"></script>
	
  </head>
  
  <body>
  		
        <!--/sidebar-->
		<s:if test="message!=null">
		<script type="text/javascript">
			var msg = "${message}";
			alert(msg);
		</script>
		</s:if>
        <div class="crumb-wrap">
            <div class="crumb-list"><i class="icon-font"></i>首页<span class="crumb-step">&gt;</span><span class="crumb-name">订单管理</span></div>
        </div>
        <div class="search-wrap">
            <div class="search-content">
            	
                <form action="searchKind" method="post">

                    <table class="search-tab">
                        <tr>
                            <th width="120">选择分类:</th>
                            <td>
                                <s:select  id="searchId" name="searchkind"  list="#{1:'订单号',2:'配送员名字',3:'状态',4:'时间'}">
							</s:select>
                            </td>
                            <th width="70">关键字:</th>
                            <td><input  class="common-text" placeholder="关键字" name="searchtext" value="" id="searchtext1" type="text"></td>
                            <td><s:select   id="searchtext2" name="searchtext"  list="#{1:'已下单',2:'已存入',3:'已取出',4:'已取消'}">
							</s:select></td>
							<td><input type="text" value="" id="searchtext3" name="searchtext"/></td>
							<td><input type="text" value="" id="searchtext4" name="searchtext"/></td>
                            <td><input class="btn btn-primary btn2" name="sub" value="查询" type="submit"></td>
                        </tr>
                    </table>
                </form>

            </div>
        </div>
        <div class="result-wrap">
            <form name="myform" id="myform" method="post">
                <div class="result-title">
                    <div class="result-list">
                        <a href="preAddOrdertable"><i class="icon-font"></i>新增订单</a>
                    </div>
                </div>
                <div class="result-content">
                    <table class="result-tab" width="100%">
                        <tr>
                            <th class="tc" width="5%"><input class="allChoose" name="" type="checkbox"></th>
                            <th>订单号</th>
                            <th>派送员</th>
                            <th>机器片区</th>
                            <th>收货人电话</th>
                            <th>收货人姓名</th>
                            <th>收货人地址</th>
                            <th>是否加热</th>
                            <th>下单时间</th>
                            <th>状态</th>
                            <th>操作</th>
                        </tr>
                        <s:iterator value="listordertable" var="lot">
                        	<tr>
                        	<td class="tc"><input name="id[]" value="59" type="checkbox"></td>
                        	<td><s:property value="#lot.orderId"/></td>
                        	
                        	<td><s:property value="#lot.disparter.name"/></td>
                        	<td><s:property value="#lot.machine.machineaddress.name"/></td>
                        	<td><s:property value="#lot.receiverPhone"/></td>
                        	<td><s:property value="#lot.receiverName"/></td>
                        	<td><s:property value="#lot.receiverAddress"/></td>
                        	<td>
                        	<s:if test="#lot.heat==0">
                        		无需加热
                        	</s:if>
                        	<s:elseif test="#lot.heat==1">
                        		需加热
                        	</s:elseif>
                        	</td>
                        	<td>
                        		<s:date name="#lot.time" format="yyyy-MM-dd HH:mm:ss"/>
                        	</td>
                        	<td>
                        	<s:if test="#lot.state==1">
                        		已下单
                        	</s:if>
                        	<s:elseif test="#lot.state==2">
                        		已存入
                        	</s:elseif>
                        	<s:elseif test="#lot.state==3">
                        		已取出
                        	</s:elseif>
                        	<s:elseif test="#lot.state==4">
                        		已取消
                        	</s:elseif>
                        	</td>
                        	<td>
                                <a class="link-update" href="preDetailOrdertable?id=<s:property value="#lot.id"/>">详情</a>
                            </td>
                        	</tr>
                        </s:iterator>
                    </table>
                     <div align="center" class="result-content">
			                    	<s:iterator value="pageBean">    
			                                <tr>    
			                                 <td colspan="6" align="center" bgcolor="#5BA8DE">    
			                                 共<s:property value="allRow"/>条记录        
			                                 共<s:property value="totalPage"/>页        
			                                 当前第<s:property value="currentPage"/>页<br>    
			                                
			                                 <s:if test="%{currentPage == 1}">    
			                                   第一页  上一页    
			                                 </s:if>    
			                                 <!-- currentPage为当前页 -->    
			                                 <s:else>    
			                                   <a href="listAllOrdertable.action?page=1">第一页</a>    
			                                   <a href="listAllOrdertable.action?page=<s:property value="%{currentPage-1}"/>">上一页</a>    
			                                 </s:else>    
			                                
			                                 <s:if test="%{currentPage != totalPage}">    
			                                 <a href="listAllOrdertable.action?page=<s:property value="%{currentPage+1}"/>">下一页</a>    
			                                 <a href="listAllOrdertable.action?page=<s:property value="totalPage"/>">最后一页</a>    
			                                 </s:if>    
			                                
			                                 <s:else>    
			                                 下一页  最后一页    
			                                 </s:else>    
			                                 </td>    
			                                </tr>    
			                        </s:iterator> 
                    </div>
                </div>
            </form>

        </div>
    <!--/main-->
    <script type="text/javascript" src="UI/admins/js/libs/jquery.js"></script>
    <script src="UI/css/jquery.datetimepicker.js"></script>
	<script type="text/javascript" language="javascript">
	$(document).ready(function(){
	$("#searchId option[value!='']").remove();
	var arr=new Array("订单号","配送员名字","状态","时间");
	for(var i=1;i<=arr.length;i++){
			var $option=$("<option></option>");
			$option.attr("value",i);
			$option.text(arr[i-1]);
			$("#searchId").append($option);
		}
		var temp=document.getElementById('searchtext1');
			var temp2=document.getElementById('searchtext2');
			var temp3=document.getElementById('searchtext3');
			var temp4=document.getElementById('searchtext4');
			temp.removeAttribute("hidden");
			temp.removeAttribute("disabled");
			temp2.setAttribute("hidden",true);
			temp2.setAttribute("disabled",true);
			temp3.setAttribute("hidden",true);
			temp3.setAttribute("disabled",true);
			temp4.setAttribute("hidden",true);
			temp4.setAttribute("disabled",true);
	});
	$("#searchId").change(function(){
		var a=$("#searchId").val();
		if (a=="1"){
			var temp=document.getElementById('searchtext1');
			var temp2=document.getElementById('searchtext2');
			var temp3=document.getElementById('searchtext3');
			var temp4=document.getElementById('searchtext4');
			temp.removeAttribute("hidden");
			temp.removeAttribute("disabled");
			temp2.setAttribute("hidden",true);
			temp2.setAttribute("disabled",true);
			temp3.setAttribute("hidden",true);
			temp3.setAttribute("disabled",true);
			temp4.setAttribute("hidden",true);
			temp4.setAttribute("disabled",true);
		}else if (a=="2"){
			var temp=document.getElementById('searchtext1');
			var temp2=document.getElementById('searchtext2');
			var temp3=document.getElementById('searchtext3');
			var temp4=document.getElementById('searchtext4');
			temp.removeAttribute("hidden");
			temp.removeAttribute("disabled");
			temp2.setAttribute("hidden",true);
			temp2.setAttribute("disabled",true);
			temp3.setAttribute("hidden",true);
			temp3.setAttribute("disabled",true);
			temp4.setAttribute("hidden",true);
			temp4.setAttribute("disabled",true);
		}else if (a=="3"){
			var temp=document.getElementById('searchtext1');
			var temp2=document.getElementById('searchtext2');
			var temp3=document.getElementById('searchtext3');
			var temp4=document.getElementById('searchtext4');
			temp.setAttribute("hidden", true);
			temp.setAttribute("disabled", true);
			temp2.removeAttribute("hidden");
			temp2.removeAttribute("disabled");
			temp3.setAttribute("hidden",true);
			temp3.setAttribute("disabled",true);
			temp4.setAttribute("hidden",true);
			temp4.setAttribute("disabled",true);
		}else if (a=="4"){
			var temp=document.getElementById('searchtext1');
			var temp2=document.getElementById('searchtext2');
			var temp3=document.getElementById('searchtext3');
			var temp4=document.getElementById('searchtext4');
			temp.setAttribute("hidden", true);
			temp.setAttribute("disabled", true);
			temp2.setAttribute("hidden",true);
			temp2.setAttribute("disabled",true);
			temp3.removeAttribute("hidden");
			temp3.removeAttribute("disabled");
			temp4.removeAttribute("hidden");
			temp4.removeAttribute("disabled");
		}
	});
	$('#searchtext3').datetimepicker({
	mask:'9999/19/39 29:59'
	});
	$('#searchtext4').datetimepicker({
	mask:'9999/19/39 29:59'
	});
	</script>
  </body>
</html>
